/********************************************************/
/*	obj3 class by George Chew							*/
/*	For use in GeorgeLib								*/
/*	Created Mar 2013									*/
/*														*/
/*	Version 0001										*/
/********************************************************/

#ifndef __OBJ3D_H__
#define __OBJ3D_H__

#include "stdafx.h"
#include "vec3.h"
#include "Logger.h"

namespace GeorgeLib
{

	/*		How to use this class 		*/
	// obj3 a(5), b(1,2,3);
	// a.pos(1,1,1); b.pos(2,2,2);
	// a.checkcontain(b);

	class DLLEXPORT obj3
	{
	public:
		float	l; // length
		float	h; // height
		float	w; // width
		float	r; // radius

		// Indicates whether this object detects collision
		bool	bCollide;

		vec3	pos; // position
		vec3	dir; // direction

	public:
		obj3(void);									// constructor : no dimension values
		obj3(float R);								// constructor : object with sphere dimensions
		obj3(float L, float H, float W);			// constructor : object with box dimensions
		obj3(float L, float H, float W, float R);	// constructor : object with sphere and box dimensions
		obj3(obj3 &obj);							// constructor : from another object
		~obj3(void);								// destructor

		vec3	getmin(void);					// get the minimum coordinates of the bounding box
		vec3	getmax(void);					// get the maximum coordinates of the bounding box

		bool	checkcontain(obj3 obj);			// check if obj passed in is contained in this object
		bool	checkcontain(vec3 vec);				// check if point passed in is contained in this object
		bool	checkcollide(obj3 obj);			// check if obj passed in collides with this object

		void	containvec(vec3 & target);
		void	docontain(obj3 & obj);			// contain obj passed in within this object
		void	docontain(vec3 & vec);				// contain vector passed in within this object

		// output obj contents to console
		friend	ostream&		operator<<		(ostream &os, obj3 &v);
		friend	_Logger&		operator<<		(_Logger &logger, obj3 &v);
	};

} // namespace GeorgeLib

#endif // __OBJ3D_H__ //